package danran.bfs;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

/**
 * @Classname Xunfei
 * @Description TODO
 * @Date 2021/8/28 20:08
 * @Created by ASUS
 */
public class Xunfei {

    public static int[] getData() {
        Scanner scanner = new Scanner(System.in);
//        scanner.nextLine();
        return Arrays.stream(scanner.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
    }

    public static int solution() {
        int[] data = getData();
//        System.out.println(getLongest(data));
        int ans = getLongest(data);
        for (int[] ints : generate(data)) {
            ans = Math.max(ans, getLongest(ints));
        }
        return ans;
    }

    public static List<int[]> generate(int[] data) {
        List<int[]> ans = new ArrayList<>();
        if (data.length == 0) return ans;
        else if (data.length == 1) {
            ans.add(data);
            return ans;
        } else {
            for (int i = 0; i < data.length - 1; i++) {
                int[] newArry = Arrays.copyOf(data, data.length);
                int t = newArry[i];
                newArry[i] = newArry[i + 1];
                newArry[i + 1] = t;
                ans.add(newArry);
            }
        }
        return ans;
    }

    public static int getLongest(int[] arr) {
        if (arr.length == 1) return 1;
        if (arr.length == 2) return arr[0] == arr[1] ? 2 : 1;
        int cnt = 0;
        int max = 0;
        int left = 0, right = 0;
        while (right < arr.length) {
            if (arr[left] == arr[right]) cnt++;
            else {
                max = Math.max(max, cnt);
                cnt = 1;
                left = right;
            }
            right++;
        }
        return Math.max(max, cnt);
    }

    public static void main(String[] args) {
        System.out.println(solution());
    }

}
